package com.qfjy.mapper;

import com.qfjy.entity.po.User;
import com.qfjy.entity.vo.UserVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
@Mapper
public interface UserMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(User record);

    int insertSelective(User record);

    User selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(User record);

    int updateByPrimaryKey(User record);

    @Select("select * from user")
    List<User> selectList();

    /**
     * 批量添加
     */
    int insertBatchUsers(List<User> users);

    /**
     * 批量删除
     */
    int deleteBatch(Integer userIds[]);

    /**
     * 更改状态 (有效|无效)
     */
    @Update("update user set status=#{status} where id = #{id}")
    int updateUserStatusById(@Param("status") int status,@Param("id") int id);

    /**
     * todo 用户列表 条件查询
     */
   List<User> listCondition(UserVO userVO);

    /**
     * todo 根据wid查询user
     */
    @Select("select * from user where wid=#{wid}")
    public User selectUserByWid(int wid);

    /**
     * 根据邮箱更新wid
     * @param wid
     * @param email
     * @return
     */
    @Update("update user set wid=#{wid} where email=#{email}")
    int updateUserWidByEmail(String wid,String email);

    /**
     * 根据邮箱查询用户
     * @param email
     * @return
     */
    @Select("select * from user where email=#{email}")
    User getUserByEmail(String email);

    /**
     * todo 我的会议列表
     */
    List<User> selectUserByMeetingGrabPid(String pid);
}
